import { OpenAiBackend } from "./openai";
import { BaiDuBackend } from "./baidu";
import { BaseAgentBackend, BackendTypes } from "./base";

export type { BaseAgentBackend, BackendTypes };

export enum AgentMakerEnum {
    OpenAi = "OpenAi",
    BaiDu = "BaiDu"
}

export const AgentBackendMap: Record<string, typeof BaseAgentBackend> = {
    [AgentMakerEnum.OpenAi]: OpenAiBackend,
    [AgentMakerEnum.BaiDu]: BaiDuBackend
};

export class AgentBackendFactory {
    static create(modelMaker: string): typeof BaseAgentBackend {
        const result = AgentBackendMap[modelMaker];
        if (result) {
            return result;
        } else {
            throw new Error(`Agent backend type ${modelMaker} is not supported.`);
        }
    }
}
